package top.hidoctor.auscultation.adapter;

import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import top.hidoctor.auscultation.R;

public class RankAdapter extends BaseQuickAdapter<String> {

    public RankAdapter(int layoutResId, List<String> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.getAdapterPosition();
        ImageView ivBang = helper.getView(R.id.iv_bang);
        if (helper.getAdapterPosition() < 3) {
            helper.getView(R.id.tv_number).setVisibility(View.GONE);
            helper.getView(R.id.iv_bang).setVisibility(View.VISIBLE);
            Glide.with(mContext).load(helper.getAdapterPosition() == 0 ? R.mipmap.ic_bang1 : helper.getAdapterPosition() == 1 ? R.mipmap.ic_bang2 : R.mipmap.ic_bang3)
                    .into(ivBang);
        } else {
            helper.setText(R.id.tv_number, helper.getAdapterPosition() + 1 + "");
            helper.getView(R.id.tv_number).setVisibility(View.VISIBLE);
            helper.getView(R.id.iv_bang).setVisibility(View.GONE);
        }
    }
}
